/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.unice.miage.sessions;

import fr.unice.miage.entities.CompteBanquaire;
import fr.unice.miage.entities.OperationBanquaire;
import fr.unice.miage.enumeration.TypeOperation;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author remi
 */
@Stateless
@LocalBean
public class GestionnaireOperation {

    @PersistenceContext(unitName = "BankRootRomanoHeens-ejbPU")
    private EntityManager em;
    
    public OperationBanquaire creerOperation(CompteBanquaire ca, float montant, TypeOperation type)
    {
        OperationBanquaire ob = new OperationBanquaire(ca, montant, type);
        em.persist(ob);
        return ob;
    }
    
    public OperationBanquaire creerOperation(CompteBanquaire ca,CompteBanquaire cb, float montant, TypeOperation type)
    {
        OperationBanquaire ob = new OperationBanquaire(ca,cb, montant, type);
        em.persist(ob);
        return ob;
    }
    
}
